package com.yuntuzhilian.chapter1;

import java.util.*;

/**
 * @author MrWang-shuizhishuiheshui
 * @description
 */
public class Demo5 {
    public static void main(String[] args) {
        Map<Object,Object> map=new HashMap<>();
        map.put("a",true);
        map.put(false,1);
        map.put(2,'男');
        map.put("wo","哈哈");
        map.put("ta",new ArrayList<>());

        System.out.println(map.size());
        System.out.println(map.get(false));

        //直接遍历当前的value值
        Collection<Object> cons = map.values();
        //遍历当前所有的value值集合
        for (Object c : cons) {
            System.out.println(c);
        }

        //遍历所有的键
        Set<Object> set = map.keySet();
        //遍历
        for (Object o : set) {
            System.out.println("key---   "+o
                    +"\nvalue-- "+map.get(o));
        }

    }
}
